package com.xuzhiguang.baidu.pan.sdk.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.util.List;

/**
 * @author xuzhiguang
 * @date 2020/6/27 3:22
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public class UploadPreCreateParams {

    /**
     * 上传后使用的文件绝对路径
     */
    private String path;

    /**
     * 文件大小，单位B
     */
    private Long size;

    /**
     * 	是否目录，0 文件、1 目录
     */
    private Integer isdir;

    /**
     * 	固定值1
     */
    private Integer autoinit;

    /**
     * 	文件命名策略，默认0
     * 0 为不重命名，返回冲突
     * 1 为只要path冲突即重命名
     * 2 为path冲突且block_list不同才重命名
     * 3 为覆盖
     */
    private Integer rtype;

    /**
     * 上传id
     */
    private String uploadid;

    /**
     * 文件各分片MD5的json串
     */
    private List<String> blockList;

    /**
     * 	文件MD5
     */
    @JsonProperty("content-md5")
    private String contentMd5;

    /**
     * 文件校验段的MD5，校验段对应文件前256KB
     */
    @JsonProperty("slice-md5")
    private String sliceMd5;

    /**
     * 客户端创建时间， 默认为当前时间戳
     */
    private Long localCtime;

    /**
     * 	客户端修改时间，默认为当前时间戳
     */
    private Long localMtime;

    @Override
    public String toString() {
        return "UploadPreCreateParams{" +
                "path='" + path + '\'' +
                ", size=" + size +
                ", isdir=" + isdir +
                ", autoinit=" + autoinit +
                ", rtype=" + rtype +
                ", uploadid='" + uploadid + '\'' +
                ", blockList=" + blockList +
                ", contentMd5='" + contentMd5 + '\'' +
                ", sliceMd5='" + sliceMd5 + '\'' +
                ", localCtime=" + localCtime +
                ", localMtime=" + localMtime +
                '}';
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public Integer getIsdir() {
        return isdir;
    }

    public void setIsdir(Integer isdir) {
        this.isdir = isdir;
    }

    public Integer getAutoinit() {
        return autoinit;
    }

    public void setAutoinit(Integer autoinit) {
        this.autoinit = autoinit;
    }

    public Integer getRtype() {
        return rtype;
    }

    public void setRtype(Integer rtype) {
        this.rtype = rtype;
    }

    public String getUploadid() {
        return uploadid;
    }

    public void setUploadid(String uploadid) {
        this.uploadid = uploadid;
    }

    public List<String> getBlockList() {
        return blockList;
    }

    public void setBlockList(List<String> blockList) {
        this.blockList = blockList;
    }

    public String getContentMd5() {
        return contentMd5;
    }

    public void setContentMd5(String contentMd5) {
        this.contentMd5 = contentMd5;
    }

    public String getSliceMd5() {
        return sliceMd5;
    }

    public void setSliceMd5(String sliceMd5) {
        this.sliceMd5 = sliceMd5;
    }

    public Long getLocalCtime() {
        return localCtime;
    }

    public void setLocalCtime(Long localCtime) {
        this.localCtime = localCtime;
    }

    public Long getLocalMtime() {
        return localMtime;
    }

    public void setLocalMtime(Long localMtime) {
        this.localMtime = localMtime;
    }
}
